from etgui import *
from PageLayout import *
from PrefsMirrorEntries import MakeItemVersionTool

def MakePageVCS(model):
	vcSystem=PotGuiPopupButton("VCSystem")
	def UpdateVCPopup(model,path,popup=vcSystem):
		popup.RemoveAllItems()
		popup.AddItem("None","None")
		itemsList=EnvGetIndices("VCS_INTERFACE")
		for v in itemsList:
			popup.AddItem(v,v)   # (display, model)
	model.AddModelObserver(UpdateVCPopup,'VCS_INTERFACE')
	return MakePageLayout(eVObjHExpand|eVObjVCenter,
		MakeBorderedSectionLayout("General Settings",
			Form(
				items=[
					"VCS Tool", MakeFieldLayout(vcSystem),
					"Repository Directory",PotGuiDirSelector("RepositoryDir",gTextFieldLen)
				]
			)
		)
	)
